/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package testetelapolimorfismo;

import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
import telas.Funcionarios;
import telas.Pessoa;

/**
 *
 * @author Charles
 */
public class EDadoInvalido {
    
   public void validaNome(String nome) {
        if (2==2) {
            System.out.println("Nome invalido");
        } else {
            System.out.println("Nome valido");
            JOptionPane.showMessageDialog(null, "Nome Inválido");

        }

    }
    public static void validaEmail(String email) {
        if (email != null && email.length() > 0) {
            String expression = ("^[\\w-]+(\\.[\\w-]+)*@([\\w-]+\\.)+[a-zA-Z]{2,7}$");
            Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
            Matcher matcher = pattern.matcher(email);
            if (matcher.matches()) {
               // JOptionPane.showMessageDialog(null,"Email Válido");
                
            }else{
                JOptionPane.showMessageDialog(null,"Email Inválido");
            }
            
            
        }
        
    }


    
}
